#ifndef _LISTTEXTBOX_H_
#define _LISTTEXTBOX_H_

#pragma once
#include "list"
#include "string.h"
#include "..\CreateTextbox\Textbox.h"
#include <iostream>

typedef std::list<std::string> LISTSTR;
struct  Selector {
	LISTSTR::iterator opcionActual;
	int numCaj;
};

class ListTextBox {
private:
	//Array of showed boxes.
	Textbox* cajas[4];
	int cantCajas;
	//List of strings/options saved.
	LISTSTR* opciones; 
	//First selector points to the first element showed in the listbox.
	Selector selectorPrimero;
	//Last selector points to the Last element showed in the listbox.
	Selector selectorUltimo;
	//Current selector points to the current element selected in the listbox.
	Selector selectorActual;
	SDL_Surface* screen;

public:
	ListTextBox(SDL_Surface* screen);
	ListTextBox(SDL_Surface* screen, int showOpts, int x, int y, int w, int h, LISTSTR* optNames);
	ListTextBox(SDL_Surface* screen, int showOpts, int x, int y, int w, int h);
	/**
	Adds the string received to the list.
	**/
	void addOption(std::string newOpt);

	/**
	Deletes the selected option
	**/
	std::string deleteOption();
	/**
	Handles events, mainly regarding box selected.
	**/
	void handleEvent(SDL_Event* event);
	/**
	Scrolls the listbox downwards.
	**/
	void scrollDown(void);
	/**
	Scrolls the listbox upwards.
	**/
	void scrollUp(void);

	/**
	Draws the listbox.
	**/
	void draw();
	~ListTextBox(void);
};

#endif
